<template>
  <div>
    <p class="title">热销单品</p>
    <div class="list" >
      <div class="pic" v-for="(item, index) in list" :key="index">
        <img :src="item.img" alt="" />
        <p>{{ item.title }}</p>
      </div>
  </div>
   <p class="title">家庭常用</p>
      <div class="list" >
      <div class="pic" v-for="(item, index) in arr" :key="index">
        <img :src="item.img" alt="" />
        <p>{{ item.title }}</p>
      </div>
    </div>
  </div>

</template>

<script>
import api from "../../api";
export default {
  name: "List",
  data() {
    return {
      list: [],
      arr:[]
    };
  },
  mounted() {
    api.getHotSale().then((res) => {
      // console.log(res.data);
      if (res.data.list) {
        this.list = res.data.list;
      }
    });
    api.getFamilyComUsed().then((res)=>{
      // console.log(res.data);
      if(res.data.list){
        this.arr=res.data.list
      }
    })
  },
};
</script>

<style>
.title {
  font-size: 0.32rem;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
  color: rgb(71, 67, 67);
}
.list {
  height: 2.4rem;
  width: 95%;
  margin-left: 2.5%;
  border-radius: 1px solid #d3d3d3;
  display: flex;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  -webkit-box-shadow: #ccc 0px 0px 10px;
  -moz-box-shadow: #ccc 0px 0px 10px;
  box-shadow: #ccc 0px 0px 10px;
}
.list .pic img {
  height: 1.2rem;
  width: 1.2rem;
  margin-top: 0.4rem;
  margin-left: 0.5rem;
  border-radius: 50%;
  flex: 1;
}
.list .pic p {
  font-size: 0.24rem;
  margin-left: 0.5rem;
}
</style>